package com.example.javaee.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.javaee.domain.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User>{

    @Select("select * from user where username=#{username}")
    User selectByName(String username);

    @Select("select id,username,headerUrl,avatar,college,major,grade,email,type from user where username=#{username}")
    User getSomeUserInfo(String username);

    @Update("update user set username=#{username}, college=#{college}, major=#{major} ,grade=#{grade} WHERE id = #{id}")
    void updateUserInfo(User user);

    @Update("update user set password=#{password} WHERE id = #{id}")
    void updateUserPassword(User user);
}
